package 版本1.controller;

import 版本1.annotation.GetMapping;
import 版本1.annotation.PostMapping;
import 版本1.annotation.RequestMapping;
import 版本1.annotation.RestController;
import 版本1.pojo.Result;

import java.util.HashMap;
import java.util.Map;

@RestController()
@RequestMapping("/api")
public class TestController {
    @GetMapping("/hello")
    public String hello() {
        return "Hello, World!";
    }

    @PostMapping("/data")
    public String postData() {
        return "Data posted successfully";
    }

    @GetMapping("/get")
    public Object getMap(){
        Map<String,Object> map=new HashMap<>();
        map.put("code",1);
        map.put("data","11111");
        return map;
    }
    @GetMapping("/getResult")
    public Object getResult(){
        Result result=new Result();
        result.setCode(1);
        result.setMsg("success");
        return result;
    }
}
